home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11487 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help with writing to stdin (UNIX)
  5. Date: Sun, 24 Mar 96 16:43:47 GMT
  6. Organization: none
  7. Distribution: world
  8. Message-ID: <827685827snz@genesis.demon.co.uk>
  9. References: <199603210528.TAA02459@ss20.bnkdp.khabarovsk.su>
  10. Reply-To: fred@genesis.demon.co.uk
  11. X-NNTP-Posting-Host: genesis.demon.co.uk
  12. X-Newsreader: Demon Internet Simple News v1.27
  13. X-Mail2News-Path: genesis.demon.co.uk
  14.  
  15. In article <199603210528.TAA02459@ss20.bnkdp.khabarovsk.su>
  16.            igor@bnkdp.khabarovsk.su "Igor Kouznetsov " writes:
  17.  
  18. >I create a child process (by fork()) and need to insert some input to
  19. >the stdin (sure, stdin is the same for both parent and child 
  20. >processes) in parent, expecting that it will appear in stdin of
  21. >child. 
  22.  
  23. Process, fork(), child are Unix concepts and are not relevant to the
  24. C language. Try comp.unix.programmer.
  25.  
  26. >I tried to do that,foe example, by direct writing to buffer 
  27. >pointed by according fields of stdin FILE structure, but pointer to 
  28. >buffer associated with stdin turns to be NULL, I can't comprehand
  29. >why :-(
  30.  
  31. streams strctures are prurely local to a specific program invocation
  32. (process).
  33.  
  34. >I also made some attempts using other methods but they also failed
  35. >for different reasons, so there's no sense to describe that struggle.
  36. >
  37. >A small illustration of the task:
  38. >          ----------       ---------
  39. >         |  Parent  |     | Child   |
  40. >         |  process |     | process |
  41. >-------->|----------|---->|         |
  42. > stdin   |    ^     |     |         |
  43. >         |    |     |     |         |
  44. >         |   some   |     |         |
  45. >         |   input  |     |         |
  46. >          ---------        ---------
  47.                         ^
  48. What you have drawn here is a pipe.
  49.  
  50. >Does anybody have any idea how to realize it?
  51. >Note: I need NOT a pipe between processes but a way to insert
  52. >something namely to stdin of child process.
  53.  
  54. Not possible in general. See comp.unix.programmer for further discusion.
  55.  
  56. -- 
  57. -----------------------------------------
  58. Lawrence Kirby | fred@genesis.demon.co.uk
  59. Wilts, England | 70734.126@compuserve.com
  60. -----------------------------------------
  61.